Skip to content

Pr 433#437

Merged
Benjtalkshow merged 4 commits into
boundlessfi:mainfrom
Benjtalkshow:pr-433
Mar 4, 2026
Merged

Pr 433#437
Benjtalkshow merged 4 commits into
boundlessfi:mainfrom
Benjtalkshow:pr-433

Conversation

@Benjtalkshow

@Benjtalkshow Benjtalkshow commented Mar 4, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • Draft hackathons can now be deleted alongside published hackathons
    • Delete confirmation flow improved with differentiated messaging based on hackathon type

@vercel

vercel Bot commented Mar 4, 2026

Copy link
Copy Markdown

@Benjtalkshow is attempting to deploy a commit to the Threadflow Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Mar 4, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d6aad316-5757-4eba-8d05-63edf7662815

📥 Commits

Reviewing files that changed from the base of the PR and between d3f5153 and c2ab0a8.

📒 Files selected for processing (4)
  • app/(landing)/organizations/[id]/hackathons/page.tsx
  • hooks/hackathon/use-delete-hackathon.ts
  • lib/api/hackathons/draft.ts
  • lib/api/hackathons/index.ts

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Walkthrough

This change introduces differentiated deletion handling for hackathon drafts and published hackathons. A new DeleteType discriminant ('draft' | 'hackathon') is added throughout the deletion flow. The hook now routes to the appropriate API endpoint based on type, with optional toast suppression. The page component tracks deletion type and passes it through the hook, enabling delete functionality for both published and draft items.

Changes

Cohort / File(s) Summary
Draft Deletion API
lib/api/hackathons/draft.ts
New deleteDraft function and DeleteHackathonResponse type added to support draft deletion via DELETE /organizations/{organizationId}/hackathons/draft/{draftId} endpoint with 204 status handling.
Delete Hook Enhancement
hooks/hackathon/use-delete-hackathon.ts
Added DeleteType type and type parameter to options. Deletion logic now routes to deleteDraft or deleteHackathon based on type. Added suppressToast option and authentication/ID validation. Updated callback dependencies and return signature.
Page Integration
app/(landing)/organizations/[id]/hackathons/page.tsx
Extended hackathonToDelete state with type field. Updated handleDeleteClick to resolve correct title and populate type before opening confirmation dialog. Updated all delete button invocations to supply type ('hackathon' or 'draft'). Captures title before deletion for toast messaging.
API Export Consolidation
lib/api/hackathons/index.ts
Removed re-export of draft module from barrel export to consolidate public API surface.

Sequence Diagram

sequenceDiagram
    participant User
    participant Page as Page Component
    participant Hook as useDeleteHackathon
    participant DraftAPI as Draft API
    participant HackathonAPI as Hackathon API

    User->>Page: Click delete (type: 'draft' or 'hackathon')
    Page->>Page: Resolve title from data<br/>Populate hackathonToDelete with type
    Page->>Page: Open confirmation dialog
    User->>Page: Confirm deletion
    Page->>Page: Capture title before clearing state
    Page->>Hook: Call deleteHackathon({<br/>type, hackathonId, suppressToast})
    
    alt type === 'draft'
        Hook->>DraftAPI: DELETE /organizations/{id}/hackathons/draft/{id}
        DraftAPI-->>Hook: 204 / error response
    else type === 'hackathon'
        Hook->>HackathonAPI: DELETE /hackathons/{id}
        HackathonAPI-->>Hook: success / error response
    end
    
    Hook-->>Page: Return (isDeleting, error)
    opt suppressToast = false
        Hook->>User: Show success/error toast
    end
    Page->>User: Show success toast with captured title
    Page->>Page: Refetch hackathons data
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • Issue #416: Directly addressed by adding deleteDraft function in lib/api/hackathons/draft.ts and implementing type-based routing in the deletion hook and page component to resolve draft deletion endpoint mismatch.

Possibly related PRs

  • PR #433: Makes identical code-level changes to implement draft deletion routing in hooks/hackathon/use-delete-hackathon.ts and the hackathons page component by introducing DeleteType and conditional endpoint selection.

Suggested reviewers

  • 0xdevcollins

Poem

🐰 Hops along with joy so bright,
Drafts and hackathons deleted right!
Routes split true, type guides the way,
Two endpoints dance in deletion's play—
Carrots earned through careful code,
Success toasts mark the rightful road! 🥕

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Benjtalkshow
Benjtalkshow merged commit 609b63c into boundlessfi:main Mar 4, 2026
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants